package myJs.myPkg

import myJs.Implicits.{JArS, JDJAn, JDS}
import myJs.myPkg.jquery.JQuery
import org.scalajs.dom.Element
import slinky.readwrite.ObjectOrWritten

import scala.scalajs.js
import scala.language.implicitConversions
import scala.scalajs.js.JSConverters._
import scala.scalajs.js.annotation.JSImport
import scala.scalajs.js.annotation.JSImport.Namespace
import scala.scalajs.js.|


/**
 * Created by yz on 2019/3/14
 */

@js.native
trait BootstrapMultiselectJQuery extends js.Object {

  def multiselect(options: ObjectOrWritten[MultiselectOptions]): JQuery = scalajs.js.native

  def multiselect(): JQuery = scalajs.js.native

  def multiselect(method: String): JQuery = scalajs.js.native

  def multiselect(method: String, data: js.Any): JQuery = scalajs.js.native

  def BootstrapMultiselect(method: String, data: js.Any): JQuery = scalajs.js.native

}

case class MultiselectOptions(
                               buttonWidth: js.UndefOr[String] = js.undefined,
                               includeSelectAllOption: Boolean = false,
                               maxHeight: js.UndefOr[Int] = js.undefined,
                               enableFiltering: js.UndefOr[Boolean] = js.undefined,
                               enableCaseInsensitiveFiltering: js.UndefOr[Boolean] = js.undefined,
                               onChange: js.UndefOr[(Element, Boolean, js.Any) => Unit] = js.undefined,
                               onSelectAll: js.UndefOr[js.Array[Element] => Unit] = js.undefined,
                               onDeselectAll: js.UndefOr[js.Array[Element] => Unit] = js.undefined,
                               numberDisplayed: js.UndefOr[Int] = js.undefined,
                               nSelectedText: js.UndefOr[String] = js.undefined,
                               allSelectedText: js.UndefOr[String] = js.undefined,
                             )

trait BootstrapMultiselectJQueryImplicits {

  implicit def implicitBootstrapMultiselectJQuery(jq: JQuery) = {
    jq.asInstanceOf[BootstrapMultiselectJQuery]
  }
}


